package com.develophelper.aliyun.rocketmq.dto;

import javafx.util.Builder;

import java.io.Serializable;

/**
 * @author snaildev
 * @date 2021/05/13
 **/
public class PushDto implements Serializable {
    private static final long serialVersionUID = -1L;
    /**
     * 链路追踪id
     */
    private String traceId;
    /**
     * 事件码
     */
    private String event;
    /**
     * 来源
     */
    private String source;
    /**
     * 消息体
     */
    private String data;
    /**
     * 延时时间，单位：毫秒
     */
    private long startDeliverTime;

    public PushDto() {

    }

    public PushDto(PushDtoBuilder builder) {
        this.traceId = builder.traceId;
        this.event = builder.event;
        this.source = builder.source;
        this.data = builder.data;
        this.startDeliverTime = builder.startDeliverTime;
    }

    public String getTraceId() {
        return traceId;
    }

    public void setTraceId(String traceId) {
        this.traceId = traceId;
    }

    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public long getStartDeliverTime() {
        return startDeliverTime;
    }

    public void setStartDeliverTime(long startDeliverTime) {
        this.startDeliverTime = startDeliverTime;
    }

    public static PushDtoBuilder builder() {
        return new PushDtoBuilder();
    }


    public static class PushDtoBuilder implements Builder<PushDto> {
        /**
         * 链路追踪id
         */
        private String traceId;
        /**
         * 事件码
         */
        private String event;
        /**
         * 来源
         */
        private String source;
        /**
         * 消息体
         */
        private String data;
        /**
         * 延时时间，单位：毫秒
         */
        private long startDeliverTime;

        public PushDtoBuilder traceId(String traceId) {
            this.traceId = traceId;
            return this;
        }

        public PushDtoBuilder event(String event) {
            this.event = event;
            return this;
        }

        public PushDtoBuilder source(String source) {
            this.source = source;
            return this;
        }

        public PushDtoBuilder data(String data) {
            this.data = data;
            return this;
        }

        public PushDtoBuilder startDeliverTime(long startDeliverTime) {
            this.startDeliverTime = startDeliverTime;
            return this;
        }

        @Override
        public PushDto build() {
            return new PushDto(this);
        }
    }

}
